UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MZmYofV7Qzqy6AKO9qUePUTH7uA+DWHEu1C1G1WPCM4=' 
WHERE 
  key_id = '866ebf9cad3d571aea5e5cfdf7ab8062f9953d4a59faec3ae63f4a9e6d1c3c4b' 
  AND (
    token = 'MZmYofV7Qzqy6AKO9qUePUTH7uA+DWHEu1C1G1WPCM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021