UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cb4PhrO6N7UVQn2VIraxeGiRVfdoPV4AEnHXurm6Zz8=' 
WHERE 
  key_id = '6e09cd37a0edde531ebd86a65b4b8662718e74b38d2940be608ae80788ad96c3' 
  AND (
    token = 'Cb4PhrO6N7UVQn2VIraxeGiRVfdoPV4AEnHXurm6Zz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032