UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hhsI9PHSs/7i91e5VobVyo2WhGcZP0lC5ZYDtoTz7zA='
WHERE
key_id = 'a0349209362b74114c8222a59068f1ec2e16b734f1431bcf35c7994c87978f0a'
AND (
token = 'hhsI9PHSs/7i91e5VobVyo2WhGcZP0lC5ZYDtoTz7zA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)