UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QSB/nZ4rGGKngAi6cX07wYf1JqznMFqhykZ+3REGIrk=' 
WHERE 
  key_id = '2e5d234d751a7693f2b01c73de8c5b92a29776d31b9f23131da126c3fa5e87fb' 
  AND (
    token = 'QSB/nZ4rGGKngAi6cX07wYf1JqznMFqhykZ+3REGIrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036