UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pioLasUq+oM2t1E8RPgsV4GWLLPZSOI6jhXZYLwv3Gw='
WHERE
key_id = 'ad417fb124addcd22ef71be513ac4c9e8f3bb9c0af6616adddbab56bedbbafa4'
AND (
token = 'pioLasUq+oM2t1E8RPgsV4GWLLPZSOI6jhXZYLwv3Gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)