UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xe3RhUSwdfN+DNzk/owEqdGVORaaohrpDYEkUbUDFlQ='
WHERE
key_id = 'bc6daeaa6f683acd37f89bbb86a5a42e4f4d11b311445b7bdc00521b2f9dec04'
AND (
token = 'xe3RhUSwdfN+DNzk/owEqdGVORaaohrpDYEkUbUDFlQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)