UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWShzQaV1TaPH7GhqQFodQiN+OCaWVGIh/hl9Hp+WpI='
WHERE
key_id = 'cca6f78345cf2a4d25f1f8447a88424405519494ff38280abc2de06383246c7f'
AND (
token = 'XWShzQaV1TaPH7GhqQFodQiN+OCaWVGIh/hl9Hp+WpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)