UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3JsDKGf9hmgdVYWHQ2Rz5fAVUFo3GKqjO0EASbFo6UA=' 
WHERE 
  key_id = 'a7f8eff48cd79fa912a694eb77cd1bc156732a7670871d5b9675a52647029774' 
  AND (
    token = '3JsDKGf9hmgdVYWHQ2Rz5fAVUFo3GKqjO0EASbFo6UA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037