UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2qQa1hOSzcbhc0F6FoLD02N6SmIZ/gxv4PI1eUVe3G4='
WHERE
key_id = '87774e7d1d37e6d3fa66741adb80fc05cd740df69fadadaee33816b3919c4875'
AND (
token = '2qQa1hOSzcbhc0F6FoLD02N6SmIZ/gxv4PI1eUVe3G4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)