UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i9omW+uAw4VQlNJNxS/l1j5xi1npP7vS4I476ZrNTiY=' 
WHERE 
  key_id = '087b37bc9dad0fc53737e317bdcea525c5d909a59329fa893730ab02b182941c' 
  AND (
    token = 'i9omW+uAw4VQlNJNxS/l1j5xi1npP7vS4I476ZrNTiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034