UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iKznfgH2nDJfdsXvon7V1XZhurZ3SWR3xZqeiOlNdQ0=' 
WHERE 
  key_id = 'e21c95655e4ee0ab57cead7ca16f151ebec60088c86a675f784b6d5a3e44da3d' 
  AND (
    token = 'iKznfgH2nDJfdsXvon7V1XZhurZ3SWR3xZqeiOlNdQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044