UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/R7Xu78Wp+RUTj56JQX80CRaz2piN4Iebq+UISDWTHU='
WHERE
key_id = 'fd1564d70add88b6957e397b883003525cd471e1f661f542aba9ce5b9ac7ecfa'
AND (
token = '/R7Xu78Wp+RUTj56JQX80CRaz2piN4Iebq+UISDWTHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)