UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8Rps3Qj4ICWVbzFQUJq6r7M09qLCwzppynRLIP3N9Y=' 
WHERE 
  key_id = '9356e8c1a79f137d8739b20fdc1833397226a27d65bfab580d4c2ab3b77cb7f9' 
  AND (
    token = 'J8Rps3Qj4ICWVbzFQUJq6r7M09qLCwzppynRLIP3N9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039