UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h5S7JvkcrEm3myLWU1fhVWG2PURTfQtaDKx94jSUeac=' 
WHERE 
  key_id = '669a98c1fc6c719b63a78b21db19a7add146dc5396872c12a04d83a1ba996aa0' 
  AND (
    token = 'h5S7JvkcrEm3myLWU1fhVWG2PURTfQtaDKx94jSUeac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059