UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YrmviSqmVsQ3vh8bcOeUrlXR/PmDUoaY6iWeXxISgE8='
WHERE
key_id = '8b20025eaf8cfd9798d5336e6575a2555b37cbfffa061e13861ec2e7d7ec88a4'
AND (
token = 'YrmviSqmVsQ3vh8bcOeUrlXR/PmDUoaY6iWeXxISgE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)