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