UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EG5R4joFZ/qd/ls37CGtXspsHNPxCFfu0SW1gaozITU=' 
WHERE 
  key_id = '8e4cc6c3adfc2ab51158426b96d8a11756878de201b39658b99aa8496c226f23' 
  AND (
    token = 'EG5R4joFZ/qd/ls37CGtXspsHNPxCFfu0SW1gaozITU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028