UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agm0Fe+/w19FuJvSMetRPiqOB1DXzUZOc4dULiEotJ0='
WHERE
key_id = '99e6fafaef0e449f70c14c9aad91af1788936321b526b55957dbe09e974f2825'
AND (
token = 'agm0Fe+/w19FuJvSMetRPiqOB1DXzUZOc4dULiEotJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)