UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EYDFDFljzoq4jAiBnukkZFcahAxoDimMEK3TTNybvd4=' 
WHERE 
  key_id = 'c580ccf267121ac7ff2bb9dacb84086134421659fe2b206732e23ab98aa3f7ef' 
  AND (
    token = 'EYDFDFljzoq4jAiBnukkZFcahAxoDimMEK3TTNybvd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020