UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '28n6GasgDf+5ejNl+kXua4H02KrJyzrOysAzFxS1A94=' 
WHERE 
  key_id = 'a07ebbb8f1d098a1e4fa7141559e635f52f58442e2bdae4ec87cfa62948984c0' 
  AND (
    token = '28n6GasgDf+5ejNl+kXua4H02KrJyzrOysAzFxS1A94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056