UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kn27yxkf82Cw7yExgnj6dgd5Yip8K8iiz8X3xePVqoY='
WHERE
key_id = 'a29e6e739db66e73113e90ef5b825f922cce61f5151471376d340d80d90f730e'
AND (
token = 'kn27yxkf82Cw7yExgnj6dgd5Yip8K8iiz8X3xePVqoY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)