UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i6+iTbQUQ6TghsQlV7QAsoRllVmL99eaQW2VMto9GWg=' 
WHERE 
  key_id = 'edea524e5ac109ce4dc048524361755e231b527415a1400990194970cfdf9c71' 
  AND (
    token = 'i6+iTbQUQ6TghsQlV7QAsoRllVmL99eaQW2VMto9GWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035