UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'twhDxW9/X3nGZxs66DepYAFsP0fpbuff9KxCZeGTBoA=' 
WHERE 
  key_id = 'd7c8f92c5c00d50b45fa46bf3bd48701c87ee9084a34442b698186c28ee119c5' 
  AND (
    token = 'twhDxW9/X3nGZxs66DepYAFsP0fpbuff9KxCZeGTBoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032