UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BstYLUvBdRgeLVyoQeOZ/iRZWpUlm7zxLip+oon6yic=' 
WHERE 
  key_id = '040e8806c19b1d70018dec6be300d9fc8d8e4ac1b28dda2e4358168278d9c31e' 
  AND (
    token = 'BstYLUvBdRgeLVyoQeOZ/iRZWpUlm7zxLip+oon6yic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027