UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oMD0pSjlC4TA4DB+SgX3ism7NG6hzBQmOOr5SpohWnk='
WHERE
key_id = 'a2ab38f4b51bc454830d9afe7e751b8fda1d429692bbb95f1a00580c016b970e'
AND (
token = 'oMD0pSjlC4TA4DB+SgX3ism7NG6hzBQmOOr5SpohWnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)