UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5bkv0sicpun0LRDIvLQcdq2i6uu17iyJtUsZmRkeVTY='
WHERE
key_id = '8f5c4dc4c404e671228b3b2e10d554132066414b16f2409c10c4c0920d7c3942'
AND (
token = '5bkv0sicpun0LRDIvLQcdq2i6uu17iyJtUsZmRkeVTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)