UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NfIZvlgQI+d3+ZlyZsENK2JT6ut2PSkgHJ3wQv2t6fM=' 
WHERE 
  key_id = '5b4cba9d3155efc6f60a308e5c360cd2d0de4280dc0a6512063297f32a51ad8f' 
  AND (
    token = 'NfIZvlgQI+d3+ZlyZsENK2JT6ut2PSkgHJ3wQv2t6fM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023