UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WoqNRCktAo/BHgwgVVRXNRexWGrN4pQ5p8N+xKvoSis=' 
WHERE 
  key_id = '4823af6dfe00a7f03895e1860fc97e56051ce6d59960e1261e650c05e3761af4' 
  AND (
    token = 'WoqNRCktAo/BHgwgVVRXNRexWGrN4pQ5p8N+xKvoSis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038