UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjFgdM8x0fn0ojyV5nJmbzA2P786F0hKrB1UcxSBCf0=' 
WHERE 
  key_id = '26e3245bfe59dff41772f260bab3205808b0328cf81d645cad0b8c1d13101243' 
  AND (
    token = 'BjFgdM8x0fn0ojyV5nJmbzA2P786F0hKrB1UcxSBCf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028