UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iMALJrPd3tGSq+YhBNRXpvC1fOWbxgWyLw1oori/0CM=' 
WHERE 
  key_id = '8513fc7557c22de1ce853369390406bc05dee2f04e9db2f0f182fee649758bc4' 
  AND (
    token = 'iMALJrPd3tGSq+YhBNRXpvC1fOWbxgWyLw1oori/0CM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052