UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Aq2gU+rUULEsxkZkktQoMZdt6VfFqFPiliJ+W5PKnkM='
WHERE
key_id = 'c7cde8e410a8d017bd735fcc3680d108b5cc8c1d3d115319fbcf22ada376ee22'
AND (
token = 'Aq2gU+rUULEsxkZkktQoMZdt6VfFqFPiliJ+W5PKnkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)