UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C7otiWCWeYE7ePl0G05ACVFdFVwDVUNYRcG+WgpRRLw=' 
WHERE 
  key_id = '9e46d07943f88f9399a8b10bfa8c301021dcfc69b044c94d8b4a67bf84bbe35c' 
  AND (
    token = 'C7otiWCWeYE7ePl0G05ACVFdFVwDVUNYRcG+WgpRRLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034