UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PlcjcZIt7sruL3Jbui+nbSeO6ga89P1MYZXvSmiOWM4='
WHERE
key_id = '3677435f39d821482c6e682827f6ee9053b778b720e9725e73fbb72dffdab584'
AND (
token = 'PlcjcZIt7sruL3Jbui+nbSeO6ga89P1MYZXvSmiOWM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)