UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oVBAuOkYFepnrz613L+otA38bciWljWydXFllEirwNU='
WHERE
key_id = 'a78bff634001f24653c37eac598b424756b6f8a0ea70a1ea19f9f09486a7a6bb'
AND (
token = 'oVBAuOkYFepnrz613L+otA38bciWljWydXFllEirwNU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)